﻿using System;
using System.Xml.Linq;
using System.Collections.Generic;
using System.Collections.ObjectModel;

namespace HigLabo.Net.Twitter
{
    /// <summary>
    /// 
    /// </summary>
    public class Indices : ResponseObject
    {
        /// <summary>
        /// 
        /// </summary>
        public Int32 Start { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public Int32 End { get; set; }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="jsonText"></param>
        public Indices(String jsonText)
        {
            var cc = Newtonsoft.Json.JsonConvert.DeserializeObject(jsonText) as Newtonsoft.Json.Linq.JContainer;
            if (cc != null && cc.Count == 2)
            {
                Int32 i, j;
                if (Int32.TryParse(cc[0].ToString(), out i))
                    this.Start = Convert.ToInt32(i);
                if (Int32.TryParse(cc[1].ToString(), out j))
                    this.End = Convert.ToInt32(j);
            }
        }
    }
}
